package com.hl.apple.myapplication

import android.content.Intent
import android.view.View
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder

class JobAdpater(layoutResId: Int, data: MutableList<Jobs.DataBean.ResultsBean>?) : BaseQuickAdapter<Jobs.DataBean.ResultsBean, BaseViewHolder>(layoutResId, data) {
    override fun convert(helper: BaseViewHolder?, item: Jobs.DataBean.ResultsBean?) {

        if (item!!.welfare.isEmpty() || item.salary[0].toString() == "") {
            helper!!.getView<TextView>(R.id.job_fuli).visibility = View.INVISIBLE
        }

        helper!!.setText(R.id.jobname, item!!.jobName)
                .setText(R.id.job_require, item.city.items[0].name + "   " + item.workingExp.name + "   " + item.eduLevel.name)
                .setText(R.id.job_fuli, item.welfare.toString())
                .setText(R.id.job_money, item.salary)
                .setText(R.id.job_status, item.timeState)

        helper.itemView.setOnClickListener {
            var intent = Intent(mContext, JobDeatilActivity::class.java)
            intent.putExtra("url", item.positionURL)
            mContext.startActivity(intent)
        }
    }
}